package com.feng.modules.security;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class SessionListener implements HttpSessionListener {
	public void sessionCreated(HttpSessionEvent event) {
		HttpSession ses = event.getSession();
		String id = ses.getId() + ses.getCreationTime();
		System.out.println("SessionId="+id);
		System.out.println(event.getSession().getAttribute("user"));
	}

	public void sessionDestroyed(HttpSessionEvent event) {
		HttpSession ses = event.getSession();
		String id = ses.getId() + ses.getCreationTime();
		synchronized (this) {
			System.out.println("SessionId="+id);
			System.out.println("user="+event.getSession().getAttribute("user"));
		}
	
		
	}
}